//
//  BaseNavController.swift
//  WeiBo_Private
//
//  Created by Yangperlove on 16/1/18.
//  Copyright © 2016年 Yangperlove. All rights reserved.
//

import UIKit

class BaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
        print(childViewControllers.count)

        // Do any additional setup after loading the view.
    }

    override func pushViewController(viewController: UIViewController, animated: Bool) {
        if childViewControllers.count > 0 {
        viewController.hidesBottomBarWhenPushed = true
        }
        
        let btn = UIButton(backImageName: nil, stretchable: false, imageName: "", title: "返回", fontSize: 15, titleColor: UIColor.grayColor())
        btn.addTarget(self, action: "back", forControlEvents: .TouchUpInside)
        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: btn)
        
        //这一句代码执行完毕后才会真正的添加到导航视图控制器中成为子视图
        super.pushViewController(viewController, animated: animated)
    }
    
    func back() {
        
    }

}
